package top.jolyoulu.codegenweb.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import top.jolyoulu.codegenweb.entity.bo.form.MysqlGenCodeFormBO;
import top.jolyoulu.codegenweb.service.bll.ApiGenCodeService;
import top.jolyoulu.webcommon.entity.ResultInfo;

/**
 * 代码生成
 */
@RestController
@RequestMapping("/api/gen/code")
public class ApiGenCodeController {

    @Autowired
    private ApiGenCodeService apiGenCodeService;

    /**
     * 代码生成
     * @param bo
     * @return
     */
    @PostMapping("/mysql/gen")
    public ResultInfo mysqlGen(@RequestBody @Validated MysqlGenCodeFormBO bo) {
        String id = apiGenCodeService.gen(bo);
        return ResultInfo.success(id);
    }

}
